home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <string.h>
-
- #include "linklist.h"
-
- #define NUMELEM(a) (sizeof(a)/sizeof((a)[0]))
-
- Node *proot_node = NULL; /* start of data list */
- Node *ptail_node = NULL; /* end of data list */
- Node *pfree_node = NULL; /* next free node */
-
- unsigned int nodes_in_use = 0;
-
- main()
- {
- int code;
- static const void (*actions[])(void) = {
- myexit,
- help,
- add_node,
- display_node,
- remove_node,
- dump_asc_nodes,
- dump_des_nodes,
- count_nodes
- };
-
- while (1) {
- printf("\nEnter Action Code (1 for help): ");
- scanf("%2d", &code);
-
- if (code < 0 || code >= NUMELEM(actions)) {
- printf("\n Invalid command\n");
- continue;
- }
-
- (*actions[code])(); /* call selected action */
- }
- }
-
-